package org.example.hadoop.domain;

import org.apache.hadoop.io.WritableComparable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

/**
 * @Author: wwy
 * @Date: 2020/11/10 11:45
 */
public class AuthorCountBean implements WritableComparable<AuthorCountBean> {
    //统计数量
    private int count;

    @Override
    public void write(DataOutput dataOutput) throws IOException {
        dataOutput.writeInt(this.count);
    }

    @Override
    public void readFields(DataInput dataInput) throws IOException {
        count = dataInput.readInt();
    }

    @Override
    public int compareTo(AuthorCountBean o) {
        return o.getCount() - this.count;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }


    @Override
    public String toString() {
        return "AuthorCountBean{" +
                "count=" + count +
                '}';
    }
}
